package com.hospital.new_yygh.controller;

import com.hospital.new_yygh.entity.other.Department;
import com.hospital.new_yygh.entity.result.Result;
import com.hospital.new_yygh.service.DepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "科室表")
@RestController
@RequestMapping("/department")
@CrossOrigin
public class DepartmentController {
    //注入service
    @Autowired
    private DepartmentService departmentService;

    //查询所有科室信息
    @ApiOperation(value = "获取所有科室信息")
    @GetMapping("findAllDepartment")
    public Result findAllDepartment(){
        //调用service中的方法
        List<Department> list = departmentService.list();
        return Result.ok(list);
    }
}
